#!/bin/bash

#kubectl get pod -n tls-prod --no-headers --kubeconfig=/root/.kube/config-vspprod|awk '{print $1,$2,$4}'
#kubectl get pod -n tlsmt-prod --no-headers --kubeconfig=/root/.kube/config-vspprod|awk '{print $1,$2,$4}'
#kubectl get pod -A --no-headers --kubeconfig=/root/.kube/config-vspprod|awk '{print $1,$2,$4}'
#vsp=`kubectl get pod -n tls-prod --no-headers --kubeconfig=/root/.kube/config-vspprod|grep -v 2/2`
#bp=`kubectl get pod -n tlsmt-prod --no-headers --kubeconfig=/root/.kube/config-vspprod|grep -v 2/2`

kubectl get pod -n tls-prod --no-headers --kubeconfig=/root/.kube/config-vspprod|grep -v 2/2|awk '{print $1}' > /tmp/monprodpod
for i in `cat /tmp/monprodpod`
do
    echo $i
    ssh -o "StrictHostKeyChecking no" root@10.202.16.154 "echo "${i}-tls-prod 发生重启"|mail -s "VSP发生重启" zhang.zhe@y3.sg,dingkang.hu@y3.sg"
done

kubectl get pod -n tlsmt-prod --no-headers --kubeconfig=/root/.kube/config-vspprod|grep -v 2/2|awk '{print $1}' > /tmp/monprodpod
for i in `cat /tmp/monprodpod`
do
    echo $i
    ssh -o "StrictHostKeyChecking no" root@10.202.16.154 "echo "${i}-tlsmt-prod 发生重启"|mail -s "BP发生重启" zhang.zhe@y3.sg,dingkang.hu@y3.sg"
done
